package org.ben.xintoucloud.javase.oopnewperson;

/**
 * @Author: Ben
 * @Date: 2019/7/10 20:52
 */
public class Person {
    private String name;
    private int age;
    private boolean gender;
    private Person parter;

    public Person(String name, int age, boolean gender, Person parter) {
        this.name = name;
        this.age = age;
        this.gender = gender;
        this.parter = parter;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public boolean isGender() {
        return gender;
    }

    public void setGender(boolean gender) {
        this.gender = gender;
    }

    public Person getParter() {
        return parter;
    }

    public void setParter(Person parter) {
        this.parter = parter;
    }

    public boolean isMarry(Person person1,Person person2){
        if ((person1.parter==null)&&(person2.parter==null)&&person1.gender!=person2.gender){
            System.out.println("可以结婚");
            return true;
        }else {
            System.out.println("不可以结婚");
            return false;
        }
    }

}
